<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/10/31
 * Time: 17:36
 */

namespace Modules\Web\Http\Controllers;

use Illuminate\Http\Request;
use Modules\Web\Service\ShopService;


class ShopController extends BaseController
{
    /**
     *  获取门店下有过交易的所有用户
     *  hinq 2019 10 31
     *
     **/
    public function user_list( Request $request ){
        $arr_search = (array) $request->all();
        $n_shop_id = get_web_shop_id();
        $arr_list = ShopService::user_list( $arr_search,$n_shop_id );
        return response_json( $arr_list );
    }


    /**
     *  获取指定用户的详细信息
     *  hinq 2019 11 01
     *
     **/
    public function user_detail( Request $request ){
        $n_user_id = intval($request->get('user_id'));
        $n_shop_id = get_web_shop_id();

        $arr_data = ShopService::user_detail_for_shop($n_user_id,$n_shop_id);
        return response_json( $arr_data );
    }


    /**
     *  获取指定用户的基本信息
     *  hinq 2020 4 20
     **/
    public function user_info( Request $request ){
        $nId = $request->get('user_id');
        $arr_list = ShopService::user_info( (string) $nId );
        return response_json( $arr_list );
    }

    /**
     *  获取指定用户的基本信息
     *  hinq 2020 4 20
     **/
    public function get_rong_cloud_id( Request $request ){
        $nId = $request->get('user_id');
        $arr_list = ShopService::get_rong_cloud_id( (int) $nId );
        return response_json( $arr_list );
    }




    /**
     *  获取指定用户在当前门店下参与的活动列表
     *  hinq 2019 11 01
     *
     **/
    public function activity_list( Request $request ){
        $nId = (int) $request->get('user_id');
        $arr_list = ShopService::activity_list( (int) $nId );
        return response_json( $arr_list );
    }



    /**
     *  获取指定用户在当前门店下所有的服务订单
     *  hinq 2019 11 01
     *
     **/
    public function repairstore_order_list( Request $request ){
        $nId = (int) $request->get('user_id');
        $arr_list = ShopService::repairstore_order_list( (int) $nId );
        return response_json( $arr_list );
    }


    /**
     *  获取指定用户在当前门店下所有的普通（含活动）订单
     *  hinq 2019 11 01
     *
     **/
    public function store_order_list( Request $request){
        $nId = $request->get('user_id');
        $arr_list = ShopService::store_order_list( (int) $nId );
        return response_json( $arr_list );
    }

    /**
     *  获取指定用户在当前门店下所有的预约订单
     *  hinq 2019 11 01
     *
     **/
    public function checkpoint_order_list( Request $request){
//        $nId = (int) $request->get('user_id');
        $arr_input = (array) $request->all();
        $arr_list = ShopService::checkpoint_order_list( (array) $arr_input );
        return response_json( $arr_list );
    }


    /**
     *  获取指定门店的详细信息
     *  hinq 2019 11 04
     *
     **/
    public function shop_detail(){
        $arr_list = ShopService::get_shop_detail();
        return response_json( $arr_list );
    }


    /**
     *  获取门店服务类型变更信息时获取服务类型
     *  hinq 2019 11 04
     *
     ***/
    public function server_type_list(){
        $arr_list = ShopService::server_type_list();
        return response_json( $arr_list );
    }

    /**
     *  编辑维修店、检测站基本信息
     *  hinq 2019 11 19
     *
     **/
    public function shop_update( Request $request ){
        $arr_input = (array) $request->all();
        $arr_list = ShopService::shop_update( (array) $arr_input );
        return response_json( $arr_list );
    }



}